package designPattern.structure7.Decorator.chapter6_Decorator.test6_8;

import java.io.File;
import java.util.ArrayList;

public class Application {
    public static void showWordList(ReadWord reader, File file) {
        ArrayList<String> wordList = reader.readWord(file);
        for (int i = 0; i < wordList.size(); i++) {
            System.out.println(wordList.get(i));
        }
    }

    public static void main(String args[]) {
        String fileRoot = "/media/lily/DATA/whcc/project/modules/libtestjava/src/main/java/DesigningPatten/chapter6/test6_8/testfiles";
        System.out.println("当前路径:" + System.getProperty("user.dir"));

        ReadEnglishiWord REW = new ReadEnglishiWord();

        WordDecorator WD1 = new WordDecorator(REW, new File(fileRoot, "chinese.txt"));
        showWordList(WD1, new File(fileRoot, "word.txt"));

        WordDecorator WD2 = new WordDecorator(WD1, new File(fileRoot, "englishSentence.txt"));
        showWordList(WD2, new File(fileRoot, "word.txt"));
    }
}
  
